<?php
/*
+ --------------------------------------------------- +
|  Ineo Article Manager - Version 1.x
|  Copyright © 2005-2008, Dan Cryer and William McGann
+ --------------------------------------------------- +

Ineo Article Manager is free software; you can redistribute it and/or modify
it under the terms of version 3 of the GNU General Public License as published by
the Free Software Foundation.

Ineo Article Manager is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Ineo; see the file License.txt.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

*/

/**
 * Installer - Step 5 - Rebuild Skin Caches
 */
class install_step_6
{
	var $refresh_after_step = true;
	var $await_input        = false;

	function install_step_6( &$installer )
	{
		$this->installer =& $installer;
		$this->ipsclass  =& $installer->ipsclass;
	}

	function run_step()
	{
		$querycount = 0;
		
		$sql_updates = $this->installer->data_dir.$this->installer->ipsclass->vars['sql_driver'].'_updates.php';
		
		if( file_exists($sql_updates) )
		{
			require_once($sql_updates);
			
			foreach( $queries as $query )
			{
				$this->installer->ipsclass->DB->query($query);
				$querycount++;
			}
		}
		
		/**
		* Added 1.1, rebuild groups cache to avoid the post-install permissions problems:
		*/
		require( ROOT_PATH . 'sources/action_admin/groups.php');
		$groups = new ad_groups();
		$groups->ipsclass =& $this->ipsclass;
		$groups->rebuild_group_cache();
		
		$this->installer->status_text .= 'Database modified (' . $querycount . ' queries).<br />Groups cache updated.';
	}
}

?>